﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using QuanLyDuocPham.Controllers.QuanLyHeThong.DanhMuc;

namespace QuanLyDuocPham.View.QuanLyHeThong.DanhMuc
{
    /// <summary>
    /// Interaction logic for DONVITINH_Add_View.xaml
    /// </summary>
    public partial class DONVITINH_Add_View : Window
    {
        public DONVITINH_Add_View()
        {
            InitializeComponent();
        }
        string ma_dvt;
        public string _ma_dvt
        {
            set
            {
                ma_dvt = value;
            }
        }
        public delegate void added();
        public added done;
        DONVITINH_Control dvtctrl = new DONVITINH_Control();
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ma_dvt = dvtctrl.loadID_moi();
            dvtctrl.loadComboBox(cmbDVT);
        }

        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            dvtctrl.addData(ma_dvt, txtDien_Giai, txtSo_Luong, cmbDVT);
            ma_dvt = dvtctrl.loadID_moi();

            txtDien_Giai.Clear();
            txtSo_Luong.Clear();
            cmbDVT.SelectedItem = null;
            if (done != null)
            {
                done();
            }
        }

        private void btnBack_Click(object sender, RoutedEventArgs e)
        {
            this.Close();

        }

        private void cmbDVT_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            MessageBox.Show(cmbDVT.SelectedValue.ToString());
        }
    }
}
